﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SCG.General;

namespace TTEngine
{
    public class BatCave : RoughRoom
    {
        //clone
        public override Room Clone()
        {
            return new BatCave();
        }

        //when the room is activated, send out a swarm of bats!
        public override void ProcessImpulse()
        {
            if (_activated)
                return;
            if (Level.VisibilityMatrix.Get(CenterX, CenterY))
            {
                _activated = true;
                List<SCGPoint> pts = Level.CreatePointCluster(1, CenterX, CenterY, 6, 10, Globals.TERRAIN_FLOOR);
                if (pts.Count > 0)
                {
                    SCGPoint pt = pts[0];
                    int num = Globals.RandomIntFromTo(6, 10);
                    while (num > 0)
                    {
                        Level.SpawnMonster(pt.X, pt.Y, "Bat");
                        num--;
                    }
                }
            }
        }

        //private members
        private bool _activated = false;
    }
}
